package com.baseframe.chat.controller;

import com.baseframe.auth.utils.AuthUtil;
import com.baseframe.chat.entity.SnsChatUser;
import com.baseframe.chat.service.SnsChatUserService;
import com.baseframe.tool.result.R;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/chat/user")
@AllArgsConstructor
public class SnsChatController {

    private SnsChatUserService snsChatUserService;


    /**
     * 获取与指定某人的聊天记录
     * @param receiverUserId 好友的用户编号
     * @return 消息记录
     */
    @GetMapping("/records")
    public R<Object> getChatRecords(Long receiverUserId){

        return R.data(snsChatUserService.getUserChatRecords(AuthUtil.getUserId(),receiverUserId));
    }
}
